﻿namespace MonetDbDataProvider.Extensions
{
    using System;
    using System.Data;

    public static class TypeExtensions
    {
        public static Type ToSystemType(this DbType dbType)
        {
            switch (dbType)
            {
                case DbType.Boolean:
                    return typeof(Boolean);
                case DbType.Currency:
                    return typeof(Decimal);
                case DbType.Date:
                    return typeof(DateTime);
                case DbType.DateTime:
                    return typeof(DateTime);
                case DbType.Decimal:
                    return typeof(Decimal);
                case DbType.Double:
                    return typeof(Double);
                case DbType.Guid:
                    return typeof(Guid);
                case DbType.Int16:
                    return typeof(Int16);
                case DbType.Int32:
                    return typeof(Int32);
                case DbType.Int64:
                    return typeof(Int64);
                case DbType.String:
                    return typeof(String);
                case DbType.Time:
                    return typeof(DateTime);
                default:
                    return typeof(String);
            }
        }
    }
}
